<template>
	<view class="knowledgeManage">
		<uni-collapse accordion ref="collapse">
			<uni-collapse-item :title="item.title" :collapseLeval="1" v-for="(item,index) in knowLedgeData" :key="index" :showArrow="(item.children && item.children.length>0)?true:false">
			</uni-collapse-item>
		</uni-collapse>
	</view>
</template>

<script>
	import uniCollapse from "@/pages/send/components/uni-collapse/components/uni-collapse/uni-collapse.vue"
	export default {
		components:{
			uniCollapse
		},
		data() {
			return {
				value:['0'],
				accordionVal:'1',
				content: '折叠内容主体，可自定义内容及样式，点击按钮修改内容使高度发生变化。',
				extraIcon: {
					color: '#4cd964',
					size: '26',
					type: 'image'
				},
				knowLedgeData:[{
					title:'知识库1',
					id:16389237283823872,
					children:[{
						title:'第一章超长标题看看会',
						id:2892836423896498243,
						children:[{
							title:'第一节',
							id:393748374873
						},{
							title:'第二节',
							id:393748374873
						},{
							title:'第三节',
							id:393748374873
						}]
					},{
						title:'第二章',
						id:2892836423896498243,
					},{
						title:'第三章',
						id:2892836423896498243,
					}]
				},{
					title:'知识库2',
					id:16389237283823873,
					children:[{
						title:'章1',
						id:29374954385348
					}]
				},{
					title:'知识库3',
					id:16389237283823874
				},{
					title:'知识库4',
					id:16389237283823875
				}]
			};
		},
		methods:{
			handleHeight(){
				this.$nextTick(()=>{
					// setTimeout(()=>{
					// 	this.$refs.collapseSec.resize();
					// },500)
					setTimeout(()=>{
						this.$refs.collapse.resize();
					},300)
				})
				// setTimeout(()=>{
				// 	this.$nextTick(()=>{
				// 		this.$refs.collapse.resize();
				// 	})
				// },500)
			},
			editKnowledge(type,item){
				if(type=='section'){
					// 节
					uni.navigateTo({
						url:`/pages/send/knowledge/knowledgeLevelOne/knowledgeLevelOne?type=${type=='section'?3:1}&id=`
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
::v-deep .secondCollapse{
	width:100%;
	.uni-collapse-item__title-box{
		height:80rpx;
		line-height: 80rpx;
	}
}
::v-deep .uni-collapse-item{
	position:relative;
}
::v-deep .chapter{
	.uni-list--border{
		display: none;
	}
	.uni-list-item__container{
		padding:0 30rpx;
		box-sizing: border-box;
	}
	.chapterItem:last-child{
		.uni-collapse-item-border:last-child{
			display: none;
			opacity: 0;
		}
	}
	.sectionItem{
		height:80rpx;
		line-height: 80rpx;
		padding:0 30rpx;
		border-bottom: 1px solid #ebeef5;
	}
}
::v-deep .uni-collapse-item__title-text{
	flex:0 0 65%;
	
}
.uni-collapse-item__title-text{
	
}
</style>
